<template>
  <div>
    <h1>获取</h1>
    <ul>
      <li v-for="i in list" :key="i.id">
        <div style="font-weight: bold" v-if="i.status==0">
          <van-button @click="detail(i.id,1)">{{i.title}}</van-button>
        </div>
        <div v-else>
          <van-button @click="detail(i.id,2)">{{i.title}}</van-button>
        </div>
      </li>
    </ul>


  </div>
</template>

<script>
import myaxios from "@/http/axios";

export default {
  name: "getnotice",
  data() {
    return {
      data1: '',
      list:[],
      userid:localStorage.getItem('userid')
    }
  },
  methods: {
    getnotice_list(){
      myaxios('getnotice?id='+this.userid,'get').then(res=>{
        this.list = res.lsit
      })
    },
    detail(id,status){
      if (status==1){
        myaxios('updatenotice','post',{'user_id':this.userid,'noticeid':id}).then(res=>{{
          alert(res.code)
        }})
      }
    }
  },
  mounted() {
    this.getnotice_list()
  }
}
</script>

<style scoped>

</style>